package ifpb.ads.pd.agendacoletivaapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Process;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TimePicker;

public class CadastraHorarioFixoActivity extends Activity {

	public Button salvarAtendimento;
	public TimePicker timePickerInicio, timePickerFinal;
	public EditText descricaoAtendimentoEt;
	public CheckBox segunda, terca, quarta, quinta, sexta;
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_config_fixo);
		
		segunda = (CheckBox) findViewById(R.id.segunda_chk);
		terca = (CheckBox) findViewById(R.id.terca_chk);
		quarta = (CheckBox) findViewById(R.id.quarta_chk);
		quinta = (CheckBox) findViewById(R.id.quinta_chk);
		sexta = (CheckBox) findViewById(R.id.sexta_chk);
		salvarAtendimento = (Button) findViewById(R.id.salvar_atendimento_bt);
		timePickerInicio = (TimePicker) findViewById(R.id.horario_atendimento_inicial_tp);
		timePickerFinal = (TimePicker) findViewById(R.id.horario_atendimento_final_tp);
		descricaoAtendimentoEt = (EditText) findViewById(R.id.descricao_atendimento_et);
		carregaElementos();
	}
	
	private void carregaElementos() {
		// TODO Auto-generated method stub
		
		salvarAtendimento.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
			}
		});
		
		timePickerInicio.setIs24HourView(true);
		timePickerFinal.setIs24HourView(true);
		
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		menu.add(0, Menu.FIRST, 0, "Ajuda");
		menu.add(0, Menu.FIRST+2, 0, "Sair");
		return true;
	}

	
	@Override
	public boolean onOptionsItemSelected(MenuItem item){
		switch (item.getItemId()){
			
		case Menu.FIRST+1:
			Process.killProcess(android.os.Process.myPid());
			finish();
		default:
			return super.onOptionsItemSelected(item);
		}
	}
	
	public void chamaIntent(Class<?> classe){
		finish();
		Intent intent = new Intent(this, classe);
		startActivity(intent);
	}
	
	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		chamaIntent(MainActivity.class);
	}
	
}
